#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>

int main()
{
    int num = 0;
    int ret = fork();
    if(ret == 0)
    {
        int i = 3;
        while(i--)
        {
            printf("I am child,num = %d,&num = %p\n",num,&num);
            sleep(1);                
        }
        num = 1;
        while(1)
        {
            printf("I am child,num = %d,&num = %p\n",num,&num);
            sleep(1);
        }
    }
    else
    {
        while(1)
        {
            printf("I am father,num = %d,&num = %p\n",num,&num);
            sleep(1);
        }
    }
    return 0;
}
